import QtQuick 2.15
import QtQuick.Controls 2.15

ApplicationWindow {
    height: 550
    visible: true
    width: 400

    //
    Keys.onReleased: {
        if (event.key === Qt.Key_Tab) {
            if (thisLabel.focus) {
                thisLabel.focus = false;
            } else {
                thisLabel.focus = true;
            }
        }
    }
    onHeightChanged: console.log('height:', height)

    Column {
        anchors.centerIn: parent
        spacing: 20

        Text {
            id: thisLabel

            property alias anotherTimes: thisLabel.times
            property int times: 24

            color: focus ? "red" : "black"
            focus: true
            font.family: "Ubuntu"
            font.pixelSize: 24
            height: 2 * width
            text: "Greetings " + times
            width: 150

        }
        Button {
            text: "Click me"

            onClicked: {
                thisLabel.focus = true;
            }
        }
    }
}
